const fs = require('fs');
const path = require('path');

const sourceFile = path.join(__dirname, "..", 'extensions.yaml');
const destinationDir = path.join(__dirname, "..", 'node_modules', '.cache', 'appium');

// 创建目标目录（如果不存在）
if (!fs.existsSync(destinationDir)) {
    fs.mkdirSync(destinationDir, {recursive: true});
}

const content = fs.readFileSync(sourceFile, 'utf8');
const replacedContent = content.replace(/C:\\Users\\CruzLiu\\.appium\\node_modules\\/g, path.join(__dirname, "..", "node_modules") + path.sep);
fs.writeFileSync(path.join(destinationDir, "extensions.yaml"), replacedContent);
console.log('文件复制完成！');
